import type { FieldRule } from 'vant'
//提供校验规则
const mobileRules:FieldRule[] = [
    { required: true, message: '请输入手机号'}, 
    { pattern: /^1[3-9]\d{9}$/, message: '请输入正确格式手机号' }
]
const passwordRules:FieldRule[] = [
    { required: true, message: '请输入密码' },
    { pattern: /^\w{8,24}$/, message: '密码需要8-24个字符' }
]
const codeRules: FieldRule[] = [
    { required: true, message: '请输入短信验证码' },
    { pattern: /^\d{6}$/, message: '验证码是6个数字' }
]
//添加患者校验
const nameRules: FieldRule[] = [
    { required: true, message: '请输入真实姓名' },
    { pattern: /^(?:[\u4e00-\u9fa5·]{2,16})$/, message: '中文字符2-16个字符' }
]
const idCardRules: FieldRule[] = [
    { required: true, message: '请输入身份证号' },
    { pattern:/^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/,
      message: '身份证号格式不正确'
    }
]
export { mobileRules, passwordRules, codeRules, nameRules, idCardRules }